import { Injectable } from '@angular/core';
import { Observable } from 'rxjs/Observable';
import { HttpClient } from '@angular/common/http';
import { BaseHttpService } from '../../../../shared/services/baseHttp.service';
import { NewsArticleModel } from './models/newsArticle.model';

/**
 * Company overview main service
 * 
 * Author: Sorin Spiru
 * Date: 13.01.2018
 */
@Injectable()
export class CompanyOverviewService extends BaseHttpService {
    constructor(public http: HttpClient) {
        super();
    }

    /**
     * Get company's news articles
     * @param companyId Company unique identifier
     */
    public getNewsArticles(companyId: string): Observable<NewsArticleModel[]> {
        return this.http.get<NewsArticleModel[]>(this.serverUrl + 'controversiesserv/api/v1/company/' + companyId + '/newsArticles');
    }
}